﻿using NP.BPMReportPlatform.Entities.BPM_Platform;
using NP.BPMReportPlatform.Reports.CommonApprovalProcessReport;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Text;

namespace NP.BPMReportPlatform.DBHelper
{
    public class SqlFuncExtension : BPMReportPlatformAppService, ISqlFuncExtension
    {
        private static List<SqlFuncExternal> ExpandSqlFuncs = null;
        private static readonly object _lockObj = new object();
        public SqlFuncExtension() 
        {
            if (ExpandSqlFuncs == null)
            {
                lock (_lockObj)
                {
                    if (ExpandSqlFuncs == null)
                    {
                        ExpandSqlFuncs = new List<SqlFuncExternal>();
                        ExpandSqlFuncs.AddRange(new CommonSqlFuncExtension().ExpandSqlFuncs);
                        ExpandSqlFuncs.AddRange(new CommonApprovalSqlFuncExtension().ExpandSqlFuncs);
                        //Console.WriteLine(ExpandSqlFuncs.Count);
                    }
                }
            }
            //Console.WriteLine($"主构造方法:{ExpandSqlFuncs?.Count ?? 0}");
        }
        public List<SqlFuncExternal> GetExpandSqlFuncs()
        {
            return ExpandSqlFuncs;
        }
    }
}
